﻿create or replace function posterminal2xml(bigint, text, text, bigint, bigint, integer)
returns xml as
$$
	declare
		posterminalId alias for $1;
		serialNumber alias for $2;
		inventoryNumber alias for $3;
	begin
		return 
			xmlelement(
				name posterminal, xmlattributes(posterminalid as id), 
				xmlelement(name serialnumber, serialNumber), 
				xmlelement(name inventorynumber, inventoryNumber)
				)
		;
	end;
$$ language plpgsql immutable; -- same result for same data